React = require('react')
Toast = require('antd-mobile/lib/toast')
RefreshControl = require('antd-mobile/lib/refresh-control')
TopNotice = require('antd-mobile/lib/notice-bar')
{StyleSheet,WebView,View,Image,Text,ScrollView,TouchableHighlight,StyleSheet,Navigator,ListView,ActivityIndicator,TouchableOpacity} = require('react-native')
Dimensions = require('Dimensions')
{ width, height } = Dimensions.get('window')
{View} = require('react-native')
_ = require('underscore')
moment = require('moment')
backImg = require('../img/back.png')

BaseWebView =
  getInitialState:->
    loadingError:false
  _processTime:(time)->
    t = moment(time)
    t.format('DD/HHmm')
  onLoadingError:->
    <View>
      <Text>数据加载失败，请重试</Text>
    </View>
  render:->
    <View style={width:width,height:height,flexDirection:'column',backgroundColor:'#ffffff'}>
      {@renderHeader()}
      {
        if @props.connected
          <WebView
            style={{flex:1}}
            ref="webView"
            startInLoadingState=true
            renderError={@onLoadingError}
            injectedJavaScript={@injectedJavaScript()}
            javaScriptEnabled={true}
            domStorageEnabled={true}
            source={@source()}>
          </WebView>
      }
    </View>
# source={{uri:'http://www.sohu.com',method:'GET'}}
# source={{uri:"http://202.136.214.163:801/PilotGxWh_yhy.aspx"}}>

styles = StyleSheet.create
  row:
    flexDirection:'row'
    borderWidth:0.3
    borderStyle:'solid'
    borderColor:'#CCCCCC'
    backgroundColor:'#ffffff'
    padding:10
    marginLeft:10
    marginRight:10
  cell:
    flex:1
    flexDirection:'row'
  text:
    flex:1
  centering:
    alignItems: 'center',
    justifyContent: 'center',
    padding: 8,
module.exports = BaseWebView
